home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16603 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.synapse.net!news-admin
  2. From: phill@synapse.net (Phil Lachance)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Determining Array size
  5. Date: Thu, 11 Apr 1996 01:55:22 GMT
  6. Organization: Chromatic Consulting
  7. Distribution: world
  8. Message-ID: <316c6400.108237600@news.synapse.net>
  9. References: <316a9cef.44425478@news.synapse.net> <4kgl02$gnn@gutemine.informatik.uni-kiel.de>
  10. NNTP-Posting-Host: violin-10.synapse.net
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. On 10 Apr 1996 15:44:02 GMT, ma@informatik.uni-kiel.de (Martin
  14. Ameskamp) wrote:
  15.  
  16. >    If we're talking about low-level, C-type arrays - no.
  17. >    The only way to get information about the array size is to call
  18. >    sizeof on the actual array variable (_NOT_ on a pointer that
  19. >    points to the first element of the array).
  20. >
  21. >    A function that is passed an array as a parameter doesn't know
  22. >    the size (of course, you can explicitly pass the size in a separate
  23. >    parameter or use a special element - like 0 in C strings - to
  24. >    denote the array end or ...)
  25.  
  26. What I am looking for is a way to determine the size of an array that
  27. is passed to a template function.  I basically want to be able to take
  28. any array (char, int, float...) and be able to do something to it.  I
  29. want to pass an array and nothing else.
  30.  
  31.  
  32. _________________________________
  33. Phil Lachance <phill@synapse.net>
  34.